import axios from "axios";

const instance = axios.create({
  baseURL: "https://192.168.6.212", //接口统一域名
  timeout: 6000, //设置超时
  headers: {
    'Content-Type': 'application/json;charset=UTF-8',
  }
})

// request拦截器
instance.interceptors.request.use(
  (config) => {
    return config;
  },
  (error) => {
    Promise.reject(error);
  }
);
// 响应拦截器
instance.interceptors.response.use(
  (response) => {
    const res = response.data;

    return response.data;
  },
  (error) => {
    /* Message({
      message: '服务器调用错误',
      type: 'error',
      duration: 5 * 1000
    }) */
    console.log("服务器调用错误");

    return Promise.reject(error);
  }
);
export default instance;
